package com.jk.hly.controller;

import com.jk.hly.bean.HlyUser;
import com.jk.hly.bean.Result;
import com.jk.hly.client.HlyLoginClient;
import org.springframework.stereotype.Controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("userLogin")
public class HlyLoginController {

      @Resource
      private HlyLoginClient  loginClient;

     @ResponseBody
     @RequestMapping("zhangHaoAndPasswordLogin")
     public String  zhangHaoAndPasswordLogin(HlyUser  user){
         return  loginClient.zhangHaoAndPasswordLogin(user);
     }


     @ResponseBody
     @RequestMapping("phoneLogin")
     public Result  phoneLogin(String phone){
         return  loginClient.phoneLogin(phone);
     }


     @ResponseBody
     @RequestMapping("userPhoneLogin")
     public String  userPhoneLogin(HlyUser  user, HttpSession  session){
         String  str=loginClient.userPhoneLogin(user);
         session.setAttribute("str",str);
         session.setAttribute("phone",user.getPhone());
         return  str;
     }


}
